<#assign module="member"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/form.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default" style="height: 105px;">
				<div class="panel-heading">
					客户：${member.name}，帐号余额：${member.virtual}，消费及充值历史清单
			    </div>
			    <div class="panel-body">
    				<form class="form-inline" id="SearchForm" method="get">
    					<div class="form-group">
							<select class="form-control" data-val="true"  name="type">
								<option value="0" <#if type==0>selected="selected"</#if>>消费历史</option>
								<option value="1" <#if type==1>selected="selected"</#if>>充值历史</option>
							</select>
					    </div>
					    <div class="form-group">
			                <input class="form-control" id="startTime" name="startTime" placeholder="开始时间" readonly="readonly" type="text" value="${start?string('yyyy-MM-dd')}">
			            </div>
			            <div class="form-group">
			                <input class="form-control" id="endTime" name="endTime" placeholder="结束时间" readonly="readonly" type="text" value="${end?string('yyyy-MM-dd')}">
			            </div>
			            <div class="form-group">
			                <input type="submit" class="btn btn-default" value="查询">
			            </div>
					</form>
        		</div>
			</div>
		</div>
	</div>
	
	
	<div class="row margin-top">
		<div class="col-xs-12">
		<div class="panel panel-primary">
		<div class="table-responsive">
			<table class="table table-hover table-striped">
				<#if type==0>
					<thead>
					<tr style="font-size:14px;">
						<th>消费时间</th>
						<th>订单号</th>
						<th>消费金额</th>
						<th>消费后余额(元)</th>
						<th>消费类型</th>
						<th>备注</th>
					</tr>
					</thead>
					<tbody>
						<#if (page.content)?? >
					  	<#list page.content as data>
							<tr>
								<td>${data.created?string("yyyy-MM-dd HH:mm:ss")}</td>
								<td>
									<#if data.orderId?? && data.orderNumber??>
										<a target="_blank" href="${ctx}/order/detail/${data.orderId}" class="btn-link">***${data.orderNumber?substring(8)}</a>
									</#if>
								</td>
								<td><span style="color:#ff950b;font-weight:700;">${data.money?if_exists}</span></td>
								<td><span style="color:#ff950b;font-weight:700;">${data.afterMoney?if_exists}</span></td>
								<td>
									<#if data.paymentType=="PAYTYPE_CASH">
										现金
									<#elseif data.paymentType=="PAYTYPE_SIGN">
										签单
									<#elseif data.paymentType=="PAYTYPE_BALANCE">
										余额
									<#elseif data.paymentType=="CASH_MODIFY">
										订单修改金额
									<#elseif data.paymentType=="RECHARGE_TYPE_ADMIN">
										人工充值
									</#if>
								</td>
								<td style="max-width:450px;">${data.memo?if_exists}</td>
							</tr>
						</#list>
						</#if>
					</tbody>
				<#elseif type==1>
					<thead>
					<tr>
						<th>充值时间</th>
						<th>金额(元)</th>
						<th>充值后余额(元)</th>
						<th>充值方式</th>
						<th>操作人</th>
						<th>备注</th>
					</tr>
					</thead>
					<tbody>
						<#if (page.content)?? >
					  	<#list page.content as data>
							<tr>
								<td>${data.created?string("yyyy-MM-dd HH:mm:ss")}</td>
								<td><span style="color:#ff950b;font-weight:700;">${data.money?if_exists}</span></td>
								<td><span style="color:#ff950b;font-weight:700;">${data.afterMoney?if_exists}</span></td>
								<td>
									<#if data.paymentType=="RECHARGE_TYPE_ADMIN">
										人工充值
									<#elseif data.paymentType=="RECHARGE_TYPE_ACTIVITY">
										活动返现
									<#elseif data.paymentType=="RECHARGE_TYPE_ALIPAY">
										支付宝充值
									<#elseif data.paymentType=="RECHARGE_TYPE_WX">
										微信充值
									<#elseif data.paymentType=="RECHARGE_GIFT_CARD">
										礼品卡兑换
									<#elseif data.paymentType=="CASH_MODIFY">
										订单修改金额
									<#elseif data.paymentType=="RECHARGE_TYPE_REBATE">
										推荐提成
									</#if>
								</td>
								<td>${data.operating?if_exists}</td>
								<td style="max-width:450px;">${data.memo?if_exists}</td>
							</tr>
						</#list>
						</#if>
					</tbody>
				</#if>
			</table>
			<#if page.totalElements??>
			<ul class="pagination pull-right pagination-sm">
				<li><a>共 ${page.totalElements} 条数据</a></li>
				<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/member/inandout/${member.id}">
					<@pg.param name="type" value="${type?if_exists}"/>
					<@pg.param name="startTime" value="${start?string('yyyy-MM-dd')}"/>
					<@pg.param name="endTime" value="${end?string('yyyy-MM-dd')}"/>
					<@pg.index>
						<@pg.first>
							<li><a href="${pageUrl}">&laquo;</a></li>
						</@pg.first>
						<@pg.prev>
							<li><a href="${pageUrl}">&lsaquo;</a></li>
						</@pg.prev>
						<@pg.pages>
							<#if  currentPageNumber == pageNumber >
								<li class="active"><a href="#">${pageNumber}</a></li>
							<#else>
								<li><a href="${pageUrl}">${pageNumber}</a></li>
							</#if>
						</@pg.pages>
						<@pg.next>
							<li><a href="${pageUrl}">&rsaquo;</a></li>
						</@pg.next>
						<@pg.last>
							<li><a href="${pageUrl}">&raquo;</a></li>
						</@pg.last>
					</@pg.index>
				</@pg.pager>
			</ul>
			</#if>
		</div>
		</div>
		</div>
	</div>
	
	<div class="text-center">
		<input type="button" class="btn btn-default back" value="返回" onclick="window.location.href = '${ctx}/member/list';">
    </div>
</@override>
<@override name="footer">
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#startTime").datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
		$("#endTime").datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
	});
</script>
</@override>
<@extends name="../layout.ftl"/>